package com.sea.base.permission

import android.Manifest

/**
 * 默认权限名称
 */
object DefaultPermissionInfo {
    val transformPermissionName = fun(permissionName: String): String {
        return when (permissionName) {
            Manifest.permission.CALL_PHONE -> {
                "拨打电话"
            }

            Manifest.permission.CAMERA -> {
                "相机"
            }

            Manifest.permission.ACCESS_COARSE_LOCATION -> {
                "粗略位置"
            }

            Manifest.permission.ACCESS_FINE_LOCATION -> {
                "精细位置"
            }

            Manifest.permission.ACCESS_LOCATION_EXTRA_COMMANDS -> {
                "额外的位置"
            }

            Manifest.permission.WRITE_EXTERNAL_STORAGE -> {
                "写入外部存储"
            }

            Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.READ_MEDIA_IMAGES, Manifest.permission.READ_MEDIA_VIDEO, Manifest.permission.READ_MEDIA_AUDIO -> {
                "读取外部存储"
            }

            Manifest.permission.READ_CONTACTS -> {
                "取用户联系人信息"
            }

            Manifest.permission.WRITE_CONTACTS -> {
                "写入用户联系人信息"
            }

            Manifest.permission.RECORD_AUDIO -> {
                "录音"
            }

            Manifest.permission.READ_PHONE_STATE -> {
                "访问电话状态"
            }

            else -> {
                ""
            }
        }
    }

    val permissionPurpose = fun(permissionName: String): String {
        return when (permissionName) {
            Manifest.permission.CALL_PHONE -> {
                "拨打电话功能用于联系好友"
            }

            Manifest.permission.CAMERA -> {
                "相机功能用于拍摄和发送图片"
            }

            Manifest.permission.ACCESS_COARSE_LOCATION,
            Manifest.permission.ACCESS_FINE_LOCATION,
            Manifest.permission.ACCESS_LOCATION_EXTRA_COMMANDS -> {
                "定位功能用于展示您附近好友"
            }

            Manifest.permission.WRITE_EXTERNAL_STORAGE,
            Manifest.permission.READ_EXTERNAL_STORAGE,
            Manifest.permission.READ_MEDIA_AUDIO,
            Manifest.permission.READ_MEDIA_VIDEO,
            Manifest.permission.READ_MEDIA_IMAGES -> {
                "读写功能用于保存您在使用过程中保存图片和视频文件"
            }

            Manifest.permission.READ_CONTACTS,
            Manifest.permission.WRITE_CONTACTS -> {
                "获取联系人用于添加和获取推荐好友"
            }

            Manifest.permission.RECORD_AUDIO -> {
                "录音功能用于发送语音和语音通话"
            }

            Manifest.permission.READ_PHONE_STATE -> {
                "访问电话状态用于生成您账号的唯一凭证，确保您账号以及其中资产的安全"
            }

            else -> {
                "为了您能正常使用APP，请给予此权限"
            }
        }
    }
}